From 1edf495b0f0441fc0660b6c803f69306cf391e3b Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Wed, 16 Nov 2005 15:27:11 +0100 Subject: [PATCH] Move the registration of the @releaseDomain watch so that we avoid a watch between the watch firing and the first call to refresh. Signed-off-by: Ewan Mellor --- tools/python/xen/xend/XendDomain.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py index 5bc1a698f6..389e6114a3 100644 --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -63,14 +63,19 @@ class XendDomain: self.domains = {} self.domains_lock = threading.RLock() - xswatch("@releaseDomain", self.onReleaseDomain) - self.domains_lock.acquire() try: self._add_domain( XendDomainInfo.recreate(self.xen_domains()[PRIV_DOMAIN], True)) self.dom0_setup() + + # This watch registration needs to be before the refresh call, so + # that we're sure that we haven't missed any releases, but inside + # the domains_lock, as we don't want the watch to fire until after + # the refresh call has completed. + xswatch("@releaseDomain", self.onReleaseDomain) + self.refresh(True) finally: self.domains_lock.release() -- 2.30.2